home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Sample.bin / PrefsDialog.java < prev    next >
Text File  |  1998-09-30  |  8KB  |  190 lines

  1. /*
  2.         A basic implementation of the JDialog class.
  3. */
  4.  
  5. import java.awt.*;
  6. import com.sun.java.swing.*;
  7. import com.symantec.itools.swing.borders.TitledBorder;
  8. import com.symantec.itools.swing.models.StringComboBoxModel;
  9.  
  10. public class PrefsDialog extends com.sun.java.swing.JDialog
  11. {
  12.     public PrefsDialog(Frame parent)
  13.     {
  14.         super(parent, true);
  15.         
  16.         // This code is automatically generated by Visual Cafe when you add
  17.         // components to the visual environment. It instantiates and initializes
  18.         // the components. To modify the code, only use code syntax that matches
  19.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  20.         // parse your Java file into its visual environment.
  21.         //{{INIT_CONTROLS
  22.         setTitle("Preferences");
  23.         setDefaultCloseOperation(com.sun.java.swing.JFrame.DISPOSE_ON_CLOSE);
  24.         getContentPane().setLayout(new BorderLayout(0,0));
  25.         setSize(360,185);
  26.         setVisible(false);
  27.         getContentPane().add("Center", JTabbedPane1);
  28.         JTabbedPane1.setBounds(0,0,20,40);
  29.         JPanel1.setLayout(new GridLayout(1,2,0,0));
  30.         JTabbedPane1.add(JPanel1);
  31.         JPanel1.setBounds(0,0,20,40);
  32.         JPanel4.setBorder(titledBorder1);
  33.         JPanel4.setLayout(new BoxLayout(JPanel4,BoxLayout.Y_AXIS));
  34.         JPanel1.add(JPanel4);
  35.         JPanel4.setBounds(0,0,20,40);
  36.         JRadioButton1.setText("File in Spam Folder");
  37.         JPanel4.add(JRadioButton1);
  38.         JRadioButton1.setBounds(0,0,23,40);
  39.         JRadioButton2.setText("Auto Delete");
  40.         JPanel4.add(JRadioButton2);
  41.         JRadioButton2.setBounds(0,0,23,40);
  42.         JRadioButton3.setText("Reverse Mail-Bomb");
  43.         JPanel4.add(JRadioButton3);
  44.         JRadioButton3.setBounds(0,0,23,40);
  45.         JPanel5.setBorder(titledBorder2);
  46.         JPanel5.setLayout(new BoxLayout(JPanel5,BoxLayout.Y_AXIS));
  47.         JPanel1.add(JPanel5);
  48.         JPanel5.setBounds(0,0,20,40);
  49.         JRadioButton4.setText("None");
  50.         JPanel5.add(JRadioButton4);
  51.         JRadioButton4.setBounds(0,0,23,40);
  52.         JRadioButton5.setText("Send  Vacation Message");
  53.         JPanel5.add(JRadioButton5);
  54.         JRadioButton5.setBounds(0,0,23,40);
  55.         JRadioButton6.setText("Send Thank You Message");
  56.         JPanel5.add(JRadioButton6);
  57.         JRadioButton6.setBounds(0,0,23,40);
  58.         GridBagLayout gridBagLayout;
  59.         gridBagLayout = new GridBagLayout();
  60.         JPanel2.setLayout(gridBagLayout);
  61.         JTabbedPane1.add(JPanel2);
  62.         JPanel2.setBounds(0,0,20,40);
  63.         JLabel1.setText("Protocol");
  64.         JPanel2.add(JLabel1, new com.symantec.itools.awt.GridBagConstraintsD(0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  65.         JLabel1.setBounds(0,0,20,40);
  66.         JComboBox1.setModel(stringComboBoxModel1);
  67.         JPanel2.add(JComboBox1, new com.symantec.itools.awt.GridBagConstraintsD(1,0,1,1,0.0,0.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  68.         JComboBox1.setBounds(0,0,130,40);
  69.         JLabel2.setText("Attachments");
  70.         JPanel2.add(JLabel2, new com.symantec.itools.awt.GridBagConstraintsD(0,1,1,1,0.0,0.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  71.         JLabel2.setBounds(0,0,20,40);
  72.         JComboBox2.setModel(stringComboBoxModel2);
  73.         JPanel2.add(JComboBox2, new com.symantec.itools.awt.GridBagConstraintsD(1,1,1,1,0.0,0.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  74.         JComboBox2.setBounds(0,0,130,40);
  75.         JCheckBox1.setText("Auto Connect");
  76.         JPanel2.add(JCheckBox1, new com.symantec.itools.awt.GridBagConstraintsD(0,2,2,1,0.0,0.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  77.         JCheckBox1.setBounds(0,0,23,40);
  78.         JCheckBox2.setText("Use Compression");
  79.         JPanel2.add(JCheckBox2, new com.symantec.itools.awt.GridBagConstraintsD(0,3,2,1,0.0,0.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
  80.         JCheckBox2.setBounds(0,0,23,40);
  81.         try {
  82.             JTabbedPane1.setTitleAt(0,"Filters");
  83.             JTabbedPane1.setTitleAt(1,"Connecting");
  84.         }
  85.         catch(ArrayIndexOutOfBoundsException e) { }
  86.         JPanel3.setLayout(new FlowLayout(FlowLayout.RIGHT,5,5));
  87.         getContentPane().add("South", JPanel3);
  88.         JPanel3.setBounds(0,0,20,40);
  89.         OkButton.setText("Ok");
  90.         JPanel3.add(OkButton);
  91.         OkButton.setBounds(0,0,35,40);
  92.         CancelButton.setText("Cancel");
  93.         JPanel3.add(CancelButton);
  94.         CancelButton.setBounds(0,0,35,40);
  95.         titledBorder1.setTitle("Spam");
  96.         //$$ titledBorder1.move(0,0);
  97.         titledBorder2.setTitle("Auto Response");
  98.         //$$ titledBorder2.move(0,0);
  99.         {
  100.             String[] tempString = new String[3];
  101.             tempString[0] = "SMTP";
  102.             tempString[1] = "IMAP";
  103.             tempString[2] = "Other...";
  104.             stringComboBoxModel1.setItems(tempString);
  105.         }
  106.         //$$ stringComboBoxModel1.move(0,0);
  107.         {
  108.             String[] tempString = new String[4];
  109.             tempString[0] = "Download Always";
  110.             tempString[1] = "Ask Size > 1 Meg";
  111.             tempString[2] = "Ask Size > 5 Megs";
  112.             tempString[3] = "Ask Always";
  113.             stringComboBoxModel2.setItems(tempString);
  114.         }
  115.         //$$ stringComboBoxModel2.move(0,0);
  116.         JComboBox1.setSelectedIndex(0);
  117.         JComboBox2.setSelectedIndex(0);
  118.         //}}
  119.         
  120.         group1.add(JRadioButton1);
  121.         group1.add(JRadioButton2);
  122.         group1.add(JRadioButton3);
  123.         
  124.         group2.add(JRadioButton4);
  125.         group2.add(JRadioButton5);
  126.         group2.add(JRadioButton6);
  127.     
  128.         //{{REGISTER_LISTENERS
  129.         SymAction lSymAction = new SymAction();
  130.         OkButton.addActionListener(lSymAction);
  131.         CancelButton.addActionListener(lSymAction);
  132.         //}}
  133.     }
  134.     ButtonGroup group1 = new ButtonGroup();
  135.     ButtonGroup group2 = new ButtonGroup();
  136.     public PrefsDialog()
  137.     {
  138.         this(null);
  139.     }
  140.  
  141.     //{{DECLARE_CONTROLS
  142.     com.sun.java.swing.JTabbedPane JTabbedPane1 = new com.sun.java.swing.JTabbedPane();
  143.     com.sun.java.swing.JPanel JPanel1 = new com.sun.java.swing.JPanel();
  144.     com.sun.java.swing.JPanel JPanel4 = new com.sun.java.swing.JPanel();
  145.     com.sun.java.swing.JRadioButton JRadioButton1 = new com.sun.java.swing.JRadioButton();
  146.     com.sun.java.swing.JRadioButton JRadioButton2 = new com.sun.java.swing.JRadioButton();
  147.     com.sun.java.swing.JRadioButton JRadioButton3 = new com.sun.java.swing.JRadioButton();
  148.     com.sun.java.swing.JPanel JPanel5 = new com.sun.java.swing.JPanel();
  149.     com.sun.java.swing.JRadioButton JRadioButton4 = new com.sun.java.swing.JRadioButton();
  150.     com.sun.java.swing.JRadioButton JRadioButton5 = new com.sun.java.swing.JRadioButton();
  151.     com.sun.java.swing.JRadioButton JRadioButton6 = new com.sun.java.swing.JRadioButton();
  152.     com.sun.java.swing.JPanel JPanel2 = new com.sun.java.swing.JPanel();
  153.     com.sun.java.swing.JLabel JLabel1 = new com.sun.java.swing.JLabel();
  154.     com.sun.java.swing.JComboBox JComboBox1 = new com.sun.java.swing.JComboBox();
  155.     com.sun.java.swing.JLabel JLabel2 = new com.sun.java.swing.JLabel();
  156.     com.sun.java.swing.JComboBox JComboBox2 = new com.sun.java.swing.JComboBox();
  157.     com.sun.java.swing.JCheckBox JCheckBox1 = new com.sun.java.swing.JCheckBox();
  158.     com.sun.java.swing.JCheckBox JCheckBox2 = new com.sun.java.swing.JCheckBox();
  159.     com.sun.java.swing.JPanel JPanel3 = new com.sun.java.swing.JPanel();
  160.     com.sun.java.swing.JButton OkButton = new com.sun.java.swing.JButton();
  161.     com.sun.java.swing.JButton CancelButton = new com.sun.java.swing.JButton();
  162.     com.symantec.itools.swing.borders.TitledBorder titledBorder1 = new com.symantec.itools.swing.borders.TitledBorder();
  163.     com.symantec.itools.swing.borders.TitledBorder titledBorder2 = new com.symantec.itools.swing.borders.TitledBorder();
  164.     com.symantec.itools.swing.models.StringComboBoxModel stringComboBoxModel1 = new com.symantec.itools.swing.models.StringComboBoxModel();
  165.     com.symantec.itools.swing.models.StringComboBoxModel stringComboBoxModel2 = new com.symantec.itools.swing.models.StringComboBoxModel();
  166.     //}}
  167.  
  168.  
  169.     class SymAction implements java.awt.event.ActionListener
  170.     {
  171.         public void actionPerformed(java.awt.event.ActionEvent event)
  172.         {
  173.             Object object = event.getSource();
  174.             if (object == OkButton)
  175.                 okButton_actionPerformed(event);
  176.             else if (object == CancelButton)
  177.                 cancelButton_actionPerformed(event);
  178.         }
  179.     }
  180.  
  181.     void okButton_actionPerformed(java.awt.event.ActionEvent event)
  182.     {
  183.         dispose();
  184.     }
  185.  
  186.     void cancelButton_actionPerformed(java.awt.event.ActionEvent event)
  187.     {
  188.         dispose();
  189.     }
  190. }